package com.study.other1;

import java.util.ArrayList;
import java.util.List;
import lombok.Builder;
import lombok.Data;

/**
 * @Author tanglingyu
 * @Date: 2021/07/13/ 13:51
 * @Description
 */
public class ListTest1 {

  public static void main(String[] args) {
    List<Sb> list = new ArrayList<>();
    list.add(Sb.builder().id(1).name("123").build());
    list.add(Sb.builder().id(2).name("234").build());
    list.add(Sb.builder().id(3).name("345").build());
    if (list.parallelStream()
        .anyMatch(sb -> sb.getId() == 2)) {
      list.removeIf(sb -> sb.getName().equals("345"));
    }
    System.out.println(list);
  }


  @Data
  @Builder
  static class Sb {

    private int id;
    private String name;
  }
}
